(function($){
    //on scroll end.
    //handler : scrollEnd handler.
    //bottomDistance : 滚动条距离底部的距离,默认为0px.
    $.fn.scrollEnd = function(handler, bottomDistance) {
    	if(Type.isFunction(handler)) {
    		bottomDistance = bottomDistance || 0;
    		$(this).bind('scroll', function() {
    			if((this.scrollTop + $(this).height() + bottomDistance ) >= this.scrollHeight) {
    				handler(this);
    			}
    		});
    	} else {
            var thisDom = this.get(0),
                maxScrollTop = thisDom.scrollHeight - thisDom.clientHeight;
            if (thisDom.scrollTop < maxScrollTop){
                thisDom.scrollTop = maxScrollTop; 
            }    
    	}
    };    
    $.fn.isScrollEnd = function(){
        var thisDom = this.get(0),
            maxScrollTop = thisDom.scrollHeight - thisDom.clientHeight;
        return Math.abs(thisDom.scrollTop - maxScrollTop) < 5;
    };
})(jQuery);